<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta http-equiv="X-UA-Compatible" content="IE=edge">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>

</body>
<script>
  const p1 = new Promise((resolve, reject) => {

    try {
      console.log(`请求A数据`);
      setTimeout(() => {
        resolve(`请求A数据成功`);
        console.log(`请求A数据成功`);
      }, 2000)
    }
    catch (e) {
      console.log(e.message);
    }

  })
  console.log(`p1`, p1);

  const p2 = p1.then((value) => {
    //   const p3 = new Promise(()=>{
    //   console.log(`请求B数据`);
    //   setTimeout(() => {
    //     console.log(`B数据请求成功`);
    //   }, 3000)
    //  })
    // return p3
    return new Promise((resolve,reject) => {
      console.log(`请求B数据`);
      setTimeout(() => {
        
        console.log(`B数据请求成功`);
        resolve(`B数据请求成功`);
      }, 2000)
    }
    )
  })
  console.log(`p2`, p2);

  const p4 = p2.then(() => {

    console.log(`请求C数据`);
    setTimeout(()=>{

      console.log(`请求C数据成功`);
    },2000)
  })
  console.log(`p4`,p4);





</script>

</html>